/*
 * @Author       : Hejh(3010733382@qq.com)
 * @Version      : V1.0
 * @Date         : 2024-01-30 11:01:20
 * @Description  : 部门相关接口
 */

import type {
  DepartmentCreateReq,
  DepartmentPageRes,
  DepartmentUpdateReq,
  DepartmentSetSizeMax,
  DepartmentReq
} from '@/types/department'
import request from '@/utils/request'

// 分页查询部门接口
export const getDepartmentByPage = (params?: DepartmentReq) => {
  return request.get<DepartmentPageRes>('/dep/list', { params })
}

// 分页查询用户所在部门接口
export const getUserDepartmentByPage = (params?: DepartmentReq) => {
  return request.get<DepartmentPageRes>('/dep/userDep/list', { params })
}

// 添加部门接口
export const createDepartment = (data: DepartmentCreateReq) => {
  return request.post('/dep/create', data)
}

// 更新部门接口
export const updateDepartment = (data: DepartmentUpdateReq) => {
  return request.put('/dep/update', data)
}

// 部门排序接口
export const sortDepartment = (depIds: string[]) => {
  return request.put('/dep/sort', { depIds })
}

// 部门批量设置空间容量大小接口
export const setSizeMaxDepartment = (data: DepartmentSetSizeMax) => {
  return request.put('/dep/setSizeMax', data)
}

// 部门删除接口
export const delDepartment = (depIds: string[], picCode?: string) => {
  return request.delete('/dep/delete', { data: { depIds, picCode } })
}
